Skip to content

Add generator runtime planning, bootstrap groundwork, settings documentation, scenario scaffold hooks, and xUnit smoke tests#161

Open
cwinland wants to merge 20 commits into
masterfrom
feature/122-graph-metadata-slice
Open

Add generator runtime planning, bootstrap groundwork, settings documentation, scenario scaffold hooks, and xUnit smoke tests#161
cwinland wants to merge 20 commits into
masterfrom
feature/122-graph-metadata-slice

Conversation

@cwinland
Copy link
Copy Markdown
Owner

@cwinland cwinland commented May 2, 2026

Summary

Consolidates v5 generator foundation work including constructor planning, harness bootstrap metadata, generated-test settings model, scenario scaffold integration, and initial xUnit smoke-test emission.

Core Foundation (from #161)

  • Public constructor-planning contract via \InstanceConstructionRequest, \InstanceConstructionPlan, \InstanceConstructionParameterPlan, \InstanceConstructionParameterSource, and \Mocker.CreateConstructionPlan(...)\
  • Internal graph construction and harness-bootstrap descriptor layered on \Mocker.CreateConstructionPlan(...)\ and \MockerTestBase\
  • Shared package-layout and generated target-shape matrix from Define package-detection and target-test-shape rules for generated tests #127\ with analyzer package guidance
  • \FastMoq.Generators\ package with incremental generator for explicit partial \MockerTestBase\ targets
  • Representative generated consuming-scenario coverage, runtime parity tests, and benchmark evidence
  • Roadmap docs, solution/package/release wiring updates
  • Post-review hardening for planning semantics, analyzer performance, test-harness disposal

Settings & Documentation (from merged #163)

  • Generator groundwork documentation and validation patterns
  • Generated-test settings model and configuration contract for:
    • Framework syntax targeting (xUnit availability gating)
    • Test naming and output conventions
    • Scaffold and bootstrap selection
    • Runner/assertion style preferences
    • Hook emission and regeneration behavior

Scenario Scaffold Integration (from merged #164)

  • Scenario scaffold hooks for setup composition and fixture patterns
  • TestClassExtensions and TestBase helpers for logging and validation
  • Shared setup scenario scaffold hooks

xUnit Smoke Tests (from merged #165)

  • xUnit [Fact]\ smoke-test emission for parameterless and optional-default public instance methods
  • Support for \Task, \Task, \ValueTask, \ValueTask\ return shapes
  • xUnit metadata-based availability gating (no emission if xUnit absent)
  • Deferred placeholders with skip reasons for unsupported patterns
  • C# keyword escaping in generated invocations (e.g., \component.@Class())

Framework Property Bridge (from merged #166)

  • \FastMoqGeneratedTestFramework\ MSBuild property wiring
  • CompilerVisibleProperty declaration and AnalyzerConfigOptionsProvider integration
  • Framework setting gating: when value is 'none' (case-insensitive), xUnit smoke-test emission suppressed unconditionally

Validation

  • \dotnet test FastMoq.Tests/FastMoq.Tests.csproj --no-restore\
  • \dotnet test FastMoq.Analyzers.Tests/FastMoq.Analyzers.Tests.csproj --no-restore\
  • \dotnet test FastMoq.Tests.Web/FastMoq.Tests.Web.csproj --no-restore\
  • All tests passing: 966+ total across net8.0/net9.0/net10.0

Tracking

Copilot AI review requested due to automatic review settings May 2, 2026 22:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces generator-targeted constructor planning and internal bootstrap metadata in FastMoq by adding a public “request → plan” contract on Mocker, layering an internal construction graph and harness-bootstrap descriptor on top of that contract, and wiring MockerTestBase<TComponent> to expose these surfaces for future generator consumption.

Changes:

  • Add public construction-planning contract (InstanceConstructionRequest/InstanceConstructionPlan/InstanceConstructionParameterPlan/InstanceConstructionParameterSource) and Mocker.CreateConstructionPlan(...).
  • Add internal metadata layers (InstanceConstructionGraph, ComponentHarnessBootstrapDescriptor) plus MockerTestBase<TComponent> accessors.
  • Add focused runtime tests, update generator roadmap docs, and migrate test assertions from FluentAssertions to AwesomeAssertions.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
docs/roadmap/generator-roadmap.md Updates roadmap contract notes and records completed #122 groundwork status.
docs/roadmap/README.md Summarizes current status/direction for #125 and #122 in the roadmap index.
Directory.Packages.props Removes FluentAssertions central version entry.
FastMoq/packages.lock.json Updates locked dependency graph (incl. transitive updates).
FastMoq.Core/Models/InstanceConstructionRequest.cs Adds the public request model for constructor-selection intent.
FastMoq.Core/Models/InstanceConstructionPlan.cs Adds the public resolved-plan model + parameter plan + parameter source enum.
FastMoq.Core/Models/InstanceConstructionGraph.cs Adds internal graph node/edge metadata layered over the plan.
FastMoq.Core/Models/ComponentHarnessBootstrapDescriptor.cs Adds internal harness bootstrap descriptor for generator-targeted mapping.
FastMoq.Core/Mocker.ConstructionPlan.cs Implements CreateConstructionPlan(...), plus internal graph creation and request mapping helpers.
FastMoq.Core/KnownTypeRegistry.cs Adds helper predicates to detect known-type managed and parameter resolution.
FastMoq.Core/MockerTestBase_Constructors.cs Exposes planning/graph/bootstrap descriptor accessors on MockerTestBase<TComponent>.
FastMoq.Tests/InstanceConstructionPlanTests.cs Adds tests covering plan output across multiple resolution categories.
FastMoq.Tests/InstanceConstructionGraphTests.cs Adds tests for internal graph projection and harness hook mapping.
FastMoq.Tests/MockerTestBaseConstructionPlanTests.cs Adds tests for MockerTestBase<TComponent> planning and bootstrap descriptor behavior.
FastMoq.Tests/GlobalUsings.cs Switches assertions global usings to AwesomeAssertions.
FastMoq.Tests/FastMoq.Tests.csproj Replaces FluentAssertions with AwesomeAssertions package reference.
FastMoq.Tests.Web/GlobalUsings.cs Switches assertions global usings to AwesomeAssertions in web test project.
FastMoq.Tests/InternalSampleServiceTests.cs Removes now-unneeded FluentAssertions using.

Comment thread FastMoq.Core/Mocker.ConstructionPlan.cs Outdated
Comment thread FastMoq.Core/Mocker.ConstructionPlan.cs
Comment thread FastMoq.Core/Mocker.ConstructionPlan.cs
Copilot AI review requested due to automatic review settings May 2, 2026 23:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 6 comments.

Comment thread FastMoq.Generators/GeneratedHarnessSourceGenerator.cs Outdated
Comment thread FastMoq.Analyzers/Analyzers/MissingHelperPackageAnalyzer.cs Outdated
Comment thread FastMoq.Tests/InstanceConstructionPlanTests.cs
Comment thread FastMoq.Tests/MockerTestBaseConstructionPlanTests.cs
Comment thread FastMoq.Tests/InstanceConstructionGraphTests.cs
Comment thread FastMoq.Core/Mocker.ConstructionPlan.cs Outdated
Copilot AI review requested due to automatic review settings May 3, 2026 13:19
@cwinland cwinland self-assigned this May 3, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.

Comment thread FastMoq.Analyzers/Analyzers/MissingHelperPackageAnalyzer.cs Outdated
Comment thread FastMoq.Analyzers/Analyzers/MissingHelperPackageAnalyzer.cs Outdated
Comment thread FastMoq.code-workspace
Copilot AI review requested due to automatic review settings May 3, 2026 13:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 37 changed files in this pull request and generated 2 comments.

Comment thread FastMoq.Core/Mocker.ConstructionPlan.cs Outdated
Comment thread FastMoq.Analyzers/FastMoqAnalysisHelpers.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 37 changed files in this pull request and generated 10 comments.

Comment thread FastMoq.Tests/InstanceConstructionPlanTests.cs
Comment thread FastMoq.Benchmarks/GeneratedHarnessSetupBenchmarks.cs
Comment thread docs/benchmarks/results/generated-harness-setup-net8.md Outdated
Comment thread FastMoq.Tests/MockerTestBaseConstructionPlanTests.cs
Comment thread FastMoq.Tests/MockerTestBaseConstructionPlanTests.cs Outdated
Comment thread FastMoq.Tests/InstanceConstructionGraphTests.cs
Comment thread FastMoq.Tests/InstanceConstructionGraphTests.cs Outdated
Comment thread FastMoq.Tests/InstanceConstructionPlanTests.cs
Comment thread FastMoq.Benchmarks/GeneratedHarnessSetupBenchmarks.cs
Comment thread FastMoq.Benchmarks/GeneratedHarnessSetupBenchmarks.cs
cwinland and others added 2 commits May 3, 2026 12:01
* Document generated-test settings design for #162

* Fix generated harness parameterless constructor selection

* Define #126 scenario scaffolding contract

* Document #134 helper-family narrowing matrix

* Align generator project GUID across solutions

* Add generated shared setup scenario scaffold hooks (#164)

* Expand generated scenario scaffold executors

* Add generated shared setup scaffold hooks

* Strengthen generated shared setup hook ordering test

* Document generated scenario scaffold members

* docs: align generator roadmap with current scope

* Widen generated harness smoke test coverage (#165)

* Widen generated harness smoke test coverage

* Fix: Escape C# keywords in generated method invocations

When component methods are named with C# keywords (e.g., @Class, @return),
the unescaped IMethodSymbol.Name resulted in invalid emitted code like
'component.class()' instead of 'component.@Class()'.

- Add EscapeIdentifierIfKeyword helper using SyntaxFacts.GetKeywordKind
- Apply escaping in CreateGeneratedTestMethodModel to all method references
- Add [Fact] test covering keyword methods (@Class, @interface, @return)

Addresses code review comment on GeneratedHarnessSourceGenerator.cs

* feat(generators): wire FastMoqGeneratedTestFramework MSBuild property into generator pipeline (#123 slice 2) (#166)

Wire FastMoqGeneratedTestFramework MSBuild property into generator pipeline

- Add CompilerVisibleProperty for FastMoqGeneratedTestFramework to generator csproj
- Read build_property.FastMoqGeneratedTestFramework in incremental pipeline via AnalyzerConfigOptionsProvider
- Combine frameworkSetting with targets pipeline; pass to EmitSource
- When value is 'none' (case-insensitive), suppress xUnit smoke-test emission regardless of metadata
- Add TestAnalyzerConfigOptionsProvider / TestAnalyzerConfigOptions nested helpers for test isolation
- Add 3 new [Fact] tests covering none suppression, explicit xunit enable, and case-insensitive none

Part of #123
Copilot AI review requested due to automatic review settings May 6, 2026 19:32
@cwinland cwinland changed the title Add generator runtime planning and bootstrap groundwork Add generator runtime planning, bootstrap groundwork, settings documentation, scenario scaffold hooks, and xUnit smoke tests May 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread FastMoq.Benchmarks/GeneratedHarnessSetupBenchmarks.cs
Copilot AI review requested due to automatic review settings May 6, 2026 20:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 44 out of 44 changed files in this pull request and generated 3 comments.

Comment thread FastMoq.Generators/GeneratedHarnessSourceGenerator.cs
Comment thread docs/roadmap/generated-test-settings.md
Comment thread FastMoq.Analyzers.Tests/FastMoq.Analyzers.Tests.csproj
Copilot AI review requested due to automatic review settings May 6, 2026 21:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 45 out of 46 changed files in this pull request and generated 1 comment.

Comment on lines +422 to +427
case float floatValue:
expression = floatValue.ToString("R", CultureInfo.InvariantCulture) + "F";
return true;
case double doubleValue:
expression = doubleValue.ToString("R", CultureInfo.InvariantCulture);
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coordinate runtime prerequisites for generator-targeted output

2 participants